/*
 * Generated file. 
 * 
 * HeaderBar.java
 */
package xsp;

import com.ibm.xsp.page.compiled.AbstractCompiledPage;
import com.ibm.xsp.page.compiled.AbstractCompiledPageDispatcher;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import com.ibm.xsp.page.compiled.NoSuchComponentException;
import com.ibm.xsp.page.compiled.PageExpressionEvaluator;
import java.lang.String;
import com.ibm.xsp.component.UIViewRootEx2;
import com.ibm.xsp.component.UIPanelEx;
import java.util.Map;
import java.lang.Object;
import java.lang.Boolean;
import com.ibm.xsp.component.xp.XspOutputLabel;
import javax.faces.el.ValueBinding;

@SuppressWarnings("all")
public class HeaderBar extends AbstractCompiledPageDispatcher{
    
    public HeaderBar() {
        super("3.0");
    }

    protected AbstractCompiledPage createPage(int pageIndex) {
        return new HeaderBarPage();
    }
    
    protected boolean isCustomControl() {
        return true;
    }

    public static class HeaderBarPage extends AbstractCompiledPage {
        
        private static final ComponentInfo[] s_infos = new ComponentInfo[]{
            ComponentInfo.EMPTY_NORMAL, // 0 "labelalldocs"
            ComponentInfo.EMPTY_NORMAL, // 1 "labelmostrecentdocs"
            ComponentInfo.EMPTY_NORMAL, // 2 "labelalldocsbyauthor"
            ComponentInfo.EMPTY_NORMAL, // 3 "labelalldocsbytag"
            ComponentInfo.EMPTY_NORMAL, // 4 "labelmydocs"
            new ComponentInfo(false, new int[]{0, 1, 2, 3, 4}), // 5 "panelheader"
            new ComponentInfo(false, new int[]{5}), // 6 view
        };
        
        public HeaderBarPage() {
            super(6, s_infos );
        }
        
        public int getComponentForId(String id) throws NoSuchComponentException { 
            if( "panelheader".equals(id) )
                return 5;
            if( "labelalldocs".equals(id) )
                return 0;
            if( "labelmostrecentdocs".equals(id) )
                return 1;
            if( "labelalldocsbyauthor".equals(id) )
                return 2;
            if( "labelalldocsbytag".equals(id) )
                return 3;
            if( "labelmydocs".equals(id) )
                return 4;
            return -1;
        }
        
        public UIComponent createComponent(int id, FacesContext context,
                UIComponent parent, PageExpressionEvaluator evaluator)
                throws NoSuchComponentException { 
            switch (id) {
            case 6:
                return createView(context, parent, evaluator);
            case 5:
                return createPanelheader(context, parent, evaluator);
            case 0:
                return createLabelalldocs(context, parent, evaluator);
            case 1:
                return createLabelmostrecentdocs(context, parent, evaluator);
            case 2:
                return createLabelalldocsbyauthor(context, parent, evaluator);
            case 3:
                return createLabelalldocsbytag(context, parent, evaluator);
            case 4:
                return createLabelmydocs(context, parent, evaluator);
            }
            throw new NoSuchComponentException(id);
        }
        
        private UIComponent createView(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            UIViewRootEx2 result = new UIViewRootEx2();
            initViewRoot(result);
            return result;
        }

        private UIComponent createPanelheader(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            UIPanelEx result = new UIPanelEx();
            Map<String,Object> attrs = getAttributes(result);
            attrs.put("themeId", "Panel.header");
            setId(result, "panelHeader");
            return result;
        }

        private UIComponent createLabelalldocs(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            // loaded=??
            String loadedBnd = "#{javascript:DISPLAY_ALL_DOCUMENTS == compositeData.displayType}";
            String sourceId = "labelAllDocs/xp:this.loaded[1]/text()";
            String loaded = evaluator.evaluateAsString(null, loadedBnd, sourceId, boolean.class);
            if ( null != loaded && loaded.length() > 0 &&
                    ! Boolean.parseBoolean(loaded) ) {
                return null;
            } // else loaded was true
            XspOutputLabel result = new XspOutputLabel();
            String sourceId2 = "labelAllDocs/xp:this.value[1]/text()";
            String valueExpr = "#{javascript:var translatedTitle = \"\";\nvar searchValue = context.getUrlParameter(\"searchValue\");\nif(\"\" != searchValue){\n\ttranslatedTitle = I18n.format(res.getString(\"searchresults.title\"), searchValue);\n}else{\n\ttranslatedTitle = res.getString(\"alldocuments.title\");\n}\nreturn(translatedTitle);}";
            ValueBinding value = evaluator.createValueBinding(result, valueExpr, sourceId2,Object.class);
            result.setValueBinding("value", value);
            Map<String,Object> attrs = getAttributes(result);
            attrs.put("themeId", "ComputedField.header.subtitle");
            setId(result, "labelAllDocs");
            return result;
        }

        private UIComponent createLabelmostrecentdocs(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            // loaded=??
            String loadedBnd = "#{javascript:DISPLAY_BY_MOST_RECENT == compositeData.displayType}";
            String sourceId = "labelMostRecentDocs/xp:this.loaded[1]/text()";
            String loaded = evaluator.evaluateAsString(null, loadedBnd, sourceId, boolean.class);
            if ( null != loaded && loaded.length() > 0 &&
                    ! Boolean.parseBoolean(loaded) ) {
                return null;
            } // else loaded was true
            XspOutputLabel result = new XspOutputLabel();
            result.setValue("Most Recent Documents");
            Map<String,Object> attrs = getAttributes(result);
            attrs.put("themeId", "ComputedField.header.subtitle");
            setId(result, "labelMostRecentDocs");
            return result;
        }

        private UIComponent createLabelalldocsbyauthor(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            // loaded=??
            String loadedBnd = "#{javascript:DISPLAY_BY_AUTHOR == compositeData.displayType}";
            String sourceId = "labelAllDocsByAuthor/xp:this.loaded[1]/text()";
            String loaded = evaluator.evaluateAsString(null, loadedBnd, sourceId, boolean.class);
            if ( null != loaded && loaded.length() > 0 &&
                    ! Boolean.parseBoolean(loaded) ) {
                return null;
            } // else loaded was true
            XspOutputLabel result = new XspOutputLabel();
            result.setValue("All Documents by Author");
            Map<String,Object> attrs = getAttributes(result);
            attrs.put("themeId", "ComputedField.header.subtitle");
            setId(result, "labelAllDocsByAuthor");
            return result;
        }

        private UIComponent createLabelalldocsbytag(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            // loaded=??
            String loadedBnd = "#{javascript:DISPLAY_BY_TAG == compositeData.displayType}";
            String sourceId = "labelAllDocsByTag/xp:this.loaded[1]/text()";
            String loaded = evaluator.evaluateAsString(null, loadedBnd, sourceId, boolean.class);
            if ( null != loaded && loaded.length() > 0 &&
                    ! Boolean.parseBoolean(loaded) ) {
                return null;
            } // else loaded was true
            XspOutputLabel result = new XspOutputLabel();
            String sourceId2 = "labelAllDocsByTag/xp:this.value[1]/text()";
            String valueExpr = "#{javascript:var translatedTitle = \"\";\nvar searchValue = context.getUrlParameter(\"categoryFilter\");\nif(\"\" != searchValue){\n\ttranslatedTitle = I18n.format(res.getString(\"bytag.filtered.title\"), searchValue);\n}else{\n\ttranslatedTitle = res.getString(\"bytag.unfiltered.title\");\n}\nreturn(translatedTitle);}";
            ValueBinding value = evaluator.createValueBinding(result, valueExpr, sourceId2,Object.class);
            result.setValueBinding("value", value);
            Map<String,Object> attrs = getAttributes(result);
            attrs.put("themeId", "ComputedField.header.subtitle");
            setId(result, "labelAllDocsByTag");
            return result;
        }

        private UIComponent createLabelmydocs(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            // loaded=??
            String loadedBnd = "#{javascript:DISPLAY_MY_DOCUMENTS == compositeData.displayType}";
            String sourceId = "labelMyDocs/xp:this.loaded[1]/text()";
            String loaded = evaluator.evaluateAsString(null, loadedBnd, sourceId, boolean.class);
            if ( null != loaded && loaded.length() > 0 &&
                    ! Boolean.parseBoolean(loaded) ) {
                return null;
            } // else loaded was true
            XspOutputLabel result = new XspOutputLabel();
            result.setValue("My Documents");
            Map<String,Object> attrs = getAttributes(result);
            attrs.put("themeId", "ComputedField.header.subtitle");
            setId(result, "labelMyDocs");
            return result;
        }

    }
}
